// index.js
// 引入路由
import { createRouter, createWebHistory } from 'vue-router'
import { defineAsyncComponent } from 'vue'


// 创建路由器
// 创建路由实例
const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path:'/',
            redirect:'/index'
        },
        {
            path: '/index',
            name: 'index',
            component: defineAsyncComponent(() => import(`../view/Index.vue`)),
            meta: {
                title: '首页',
            },
        },
        {
            path: '/issue',
            name: 'issue',
            component: defineAsyncComponent(() => import(`../view/Issue.vue`)),
            meta: {
                title: '发布',
            },
        },
        {
            path: '/market',
            name: 'market',
            component: defineAsyncComponent(() => import(`../view/Market.vue`)),
            meta: {
                title: '集市',
            },
        },
        {
            path: '/mine',
            name: 'mine',
            component: defineAsyncComponent(() => import(`../view/Mine.vue`)),
            meta: {
                title: '个人',
            },
        },
        {
            path: '/selfinfo',
            name: 'selfinfo',
            component: defineAsyncComponent(() => import(`../view/SelfInformation.vue`)),
            meta: {
                title: '个人信息',
            },
        },
        {
            path: '/sign',
            name: 'sign',
            component: defineAsyncComponent(() => import(`../view/Sign.vue`)),
            meta: {
                title: '签到',
            },
        },
        {
            path: '/dorm_waiting',
            name: 'dorm_waiting',
            component: defineAsyncComponent(() => import(`../view/DormWaiting.vue`)),
            meta: {
                title: '宿舍审核',
            },
        },
        {
            path: '/dorm_info',
            name: 'dorm_info',
            component: defineAsyncComponent(() => import(`../view/DormInfo.vue`)),
            meta: {
                title: '宿舍信息',
            },
        },
        {
            path: '/dorm_add',
            name: 'dorm_add',
            component: defineAsyncComponent(() => import(`../view/DormAdd.vue`)),
            meta: {
                title: '宿舍添加',
            },
        },
    ],
});

export default router;